import { Subscription } from 'rxjs';

export class BaseComponent {
    protected subscriptions: Array<Subscription> = [];

    unsubscribeSubscribetions(){
        this.subscriptions.forEach(subscribetion => subscribetion.unsubscribe());
    }
    ngOnDestroy() {
        this.unsubscribeSubscribetions();
    }

    trackBy(index, item) {
        return item.id || item.key || index;
    }
}